#ifndef __COM_DEBUG_H__
#define __COM_DEBUG_H__

#include "usart.h"
#include "string.h"
#include "stdio.h"
#include "stdarg.h"
#include "Com_Config.h"
 #define COM_DEBUG

#ifdef COM_DEBUG
#define COM_DEBUG_INT() Com_Debug_Init()

#define __FILE strrchr(__FILE__, '\\') == NULL ? __FILE__  : strrchr(__FILE__, '\\') + 1
#define _FILE strrchr(__FILE, '/') == NULL ? __FILE  : strrchr(__FILE, '/') + 1

#define COM_DEBUG_PRINTF(format, ...) printf("[%s:%d]" format, _FILE, __LINE__, ##__VA_ARGS__)
#define COM_DEBUG_PRINTFln(format, ...) printf("[%s:%d]" format "\r\n", _FILE, __LINE__, ##__VA_ARGS__)

#else

#define COM_DEBUG_INT()

#define _FILE

#define COM_DEBUG_PRINTF(format, ...)
#define COM_DEBUG_PRINTFln(format, ...)

#endif

// 初始化Debug
void Com_Debug_Init(void);

#endif /* __COM_DEBUG_H__ */
